import request from "@/utils/request"

// 登录
export function login(data: object) {
  return request({
    url: '/user/auth/login',
    method: 'post',
    data,
  })
}

// 注册
export function register(data: object) {
  return request({
    url: '/user/auth/reg',
    method: 'post',
    data,
  })
}

// 重置登录密码
export function resPass(data: object) {
  return request({
    url: '/user/auth/resPass',
    method: 'post',
    data,
  })
}

// 获取验证码
export function sendEmail(data: object) {
  return request({
    url: '/user/auth/sendEmail',
    method: 'post',
    data,
  })
}

// 个人信息
export function getProfile() {
  return request({
    url: `/user/my`,
    method: 'get'
  })
}

// 退出登录
export function logout(data: object) {
  return request({
    url: '/user/my/logout',
    method: 'post',
    data,
  })
}

// 我的社区
export function myteam() {
  return request({
    url: `/user/my/myteam`,
    method: 'get'
  })
}

// 修改头像或名称
export function upInfo(data: object) {
  return request({
    url: '/user/my/upInfo',
    method: 'post',
    data,
  })
}

// 修改登录密码
export function upPass(data: object) {
  return request({
    url: '/user/my/upPass',
    method: 'post',
    data,
  })
}

// 修改交易密码
export function upPay(data: object) {
  return request({
    url: '/user/my/upPay',
    method: 'post',
    data,
  })
}

// 获取邮箱发送类型
export function getSendEmailType() {
  return request({
    url: `/user/auth/getSendEmailType`,
    method: 'get'
  })
}

// 判断推荐码是否存在
export function isErfCode(erfCode: string) {
  return request({
    url: `/user/auth/isErfCode/${erfCode}`,
    method: 'get'
  })
}

// 重置密码使用-判断当前账号是否绑定过Google
export function isGoogle(email: string) {
  return request({
    url: `/user/auth/isGoogle/${email}`,
    method: 'get'
  })
}

// 用户通知列表
export function getMessagePage({ pageSize, pageNo }: any) {
  return request({
    url: `/user/message/getMessagePage?pageSize=${pageSize}&pageNo=${pageNo}`,
    method: "get",
  });
}

// 用户通知已读
export function messageSetIsRead(data: object) {
  return request({
    url: '/user/message/messageSetIsRead',
    method: 'post',
    data,
  })
}